package com.sherlockHolmes;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import com.sherlockHolmes.init.base.config.MyRedissonConfig;
import com.sherlockHolmes.init.base.config.RedisConfig;
import com.sherlockHolmes.init.base.config.ThreadConfig;
import com.sherlockHolmes.init.base.config.WebSocketConfiguration;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * Hello world!
 *
 */
@SpringBootApplication
@Import({RedisConfig.class, MyRedissonConfig.class, ThreadConfig.class, WebSocketConfiguration.class})
@MapperScan("com.sherlockHolmes.init.mapper")
@EnableTransactionManagement
@EnableAsync //启用异步任务
@EnableScheduling//启用定时任务
public class App 
{
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
        return interceptor;
    }

    public static void main( String[] args )
    {
        SpringApplication.run(App.class, args);
    }
}
